#!/bin/bash
# Usage:
# ./build test
# ./build map_editor -lfltk -lfltk_gl
# ./build map_editor fltk/lib/libfltk_gl.a fltk/lib/libfltk.a -lglu32 \
#         -lopengl32 -lole32 -luuid -lcomctl32 -lgdi32 -luser32

# export "warn=-Wall -Wextra"
export "debug=-g"

function quit() { rm *.o;exit; }

for i in *.c; do
	echo "Compiling $i"
	gcc -std=c99 $warn $debug -I fltk -c -o $i.o $i || quit
done
echo "Compiling $1.cpp"
g++ $warn $debug -I fltk -c -o $1.o $1.cpp || quit
echo "Linking"
g++ *.o -o $* || quit
quit
